//
//  LifeBillModel.swift
//  KaMengApplication
//
//  Created by DUONIU_MAC on 2018/11/6.
//  Copyright © 2018年 DUONIU_MAC. All rights reserved.
//

import UIKit

class LifeBillModel: BillModel,NSCoding {
    
    var billtype : String? //账单类型
    var name : String? //姓名
    var amount : String? //金额
    var date : String? //还款日期
    var isPay = "0" //是否还清
    
    override init() {
        super.init()
        
        
    }
    
    func encode(with aCoder: NSCoder) {
        
        aCoder.encode(self.billtype, forKey: "billtype")
        aCoder.encode(self.name, forKey: "name")
        aCoder.encode(self.amount, forKey: "amount")
        aCoder.encode(self.date, forKey: "date")
        aCoder.encode(self.isPay, forKey: "isPay")
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init()
        
        self.billtype = aDecoder.decodeObject(forKey: "billtype") as? String
        self.name = aDecoder.decodeObject(forKey: "name") as? String
        self.amount = aDecoder.decodeObject(forKey: "amount") as? String
        self.date = aDecoder.decodeObject(forKey: "date") as? String
        self.isPay = (aDecoder.decodeObject(forKey: "isPay") as? String) ?? "0"
        
    }
}
